package org.jeecg.modules.monitoring.j_monitoring.job.Gateway;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.monitoring.j_monitoring.facilities.FacilitiesToken;
import org.jeecg.modules.monitoring.j_monitoring.service.impl.GatewaySystemFdnServiceImpl;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;

/**
 * 同步一次fdn对应ip
 * @Author: xiaoyq
 */

@Slf4j
public class SyncFdn implements Job {

	@Autowired
	private GatewaySystemFdnServiceImpl fdnService;

	@Autowired
	private Environment env;

	/***
	 * 执行
	 * @param jobExecutionContext
	 * @throws JobExecutionException
	 */
	@Override
	public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

		log.info(String.format("同步fdn对应ip,时间:" + DateUtils.getTimestamp()));

		if(!"prod".equals(env.getProperty("spring.profiles.active"))){
			return;
		}
		fdnService.syncFdn();


	}

}
